# _*_ coding: utf-8 _*_
import werkzeug

from odoo import http
from odoo.http import request
from odoo.addons.web.controllers.home import Home as WebHome


class Home(WebHome):
    @http.route()
    def web_login(self, redirect=None, **kw):
        if request.httprequest.method == 'GET' and not kw.get('force_login'):
            login_in_redirect_to_portal = request.env['ir.config_parameter'].sudo().get_param('login.in.redirect.to.portal')
            if login_in_redirect_to_portal:
                return werkzeug.utils.redirect(login_in_redirect_to_portal)
        return super().web_login(redirect, **kw)
